package cn.xiaopengstack.domain.tag.service;

import cn.xiaopengstack.domain.tag.model.entity.CrowdTagsJobEntity;
import cn.xiaopengstack.domain.tag.repository.ITagRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author jiangyangang
 */
@Service
@Slf4j
public class TagService implements ITagService{

    @Resource
    private ITagRepository tagRepository;

    @Override
    public void execTagBatchJob(String tagId, String batchId) {
        log.info("执行标签批量任务，将批次{}加入标签库{}", batchId, tagId);

        CrowdTagsJobEntity crowdTagsJobEntity = tagRepository.queryCrowdTagsJob(tagId, batchId);

        // 待实现...
        for (int i = 1; i <= 2; i++) {
            tagRepository.addCrowdTagsUser(tagId, "user"+i);
        }

        tagRepository.updateCrowdTagsStatistics(tagId, 2);
    }
}
